<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欢迎注册</title>
    <!-- <link href="css/register.css" rel="stylesheet"> -->
    <link rel="stylesheet" href="../../style/login/register.css">
    <script type="text/javascript" src="../../plugins/axios/axios.js"></script>
    <script type="text/javascript" src="../../plugins/vue/vue.js"></script>
    <script type="text/javascript" src="../../plugins/jQuery/jquery-3.6.0.js"></script>
    <script type="text/javascript" src="../../plugins/layer-master/dist/layer.js"></script>

    <link rel="stylesheet" href="../../plugins/element-ui/index.css">
    <!-- 引入组件库 -->
    <script src="../../plugins/element-ui/index.js"></script>
</head>
<body>
<div id="app">
    <div class="form-div">
        <div class="reg-content">
            <h1>欢迎注册</h1>
            <span>已有帐号？</span> <a href="../login/login.html">登录</a>
        </div>
        <form id="reg-form" action="#" method="post">

            <table>
                <tr>
                    <td>用户名</td>
                    <td class="inputs">
                        <input name="username" type="text" id="username" v-model="username">
                    </td>
                </tr>

                <tr>
                    <td>密码</td>
                    <td class="inputs">
                        <input name="password" type="password" id="password" v-model="password">
                    </td>
                </tr>

                <tr>
                    <td>学号/工号</td>
                    <td class="inputs">
                        <input name="phone" type="text" id="phone" v-model="userid">
                    </td>
                </tr>
            </table>
            <div class="buttons">
                <input value="注 册" type="button" id="reg_btn" @click="registerIn">
            </div>
            <br class="clear">
        </form>
    </div>
</div>


</body>
</html>
<script>
    new Vue({
        el: '#app',
        data:{
            username: '',
            password: '',
            userid: '',
        },
        methods: {
            registerIn(){
                axios({
                    url: 'http://localhost:8080/user/reg',
                    method: 'get',
                    // 传递的参数
                    params:{
                        username:this.username,
                        password:this.password,
                        userid:this.userid,
                    }
                }).then(resp=>{
                    // 跳转
                    location.href = '../login/login.html';
                })
            }
        }
    })
</script>